<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ include file="../general/header.jsp" %>
		<div id="header">FREE MARKET HOME PAGE</div>
		<%@ include file="../general/menu.jsp" %>
		<c:if test="${empty name}">
			<c:if test="${!empty errorlogin}">
				Login error, try again.
			</c:if>
			<p class="login">
					User: <input type="text" name="user" style="width:100px;" />
					Password: <input type="password" name="password" style="width:100px;" />
					<input type="submit" value="Entrar" />
			</p>
		</c:if>
		<h2>Users</h2>
		<table class="listas">
			<tr style="font-weight:bold;"> 
				<td> Username </td>  
				<td> Name </td> 
				<td> Last name </td> 				 					
				<td> E-mail </td> 
				<td> Last visit </td>
				<td> View history </td>
				<td> Ban User </td>
			</tr>
			<c:forEach var="user" items="${users}">
				<tr>
					<td> <c:out value="${user.userName}" /> </td>  
					<td> <c:out value="${user.name}" /> </td> 
					<td> <c:out value="${user.lastName}" /> </td> 				 					
					<td> <c:out value="${user.email}" /> </td>
					<td> <fmt:formatDate type="date" value="${user.lastAccess}" /> </td>
					<td> <a href="../item/listPurchaseByUser?userId=${user.id}"><img src="../../img/history.jpg" class="edit"></a></td>
					
					<c:choose>
					<c:when test="${user.isBlock}">
						<td> <a href="../user/updateBlockedStatus?userId=${user.id}"><img src="../../img/plus.jpg" class="edit"></a></td>
					</c:when>
					<c:otherwise>
						<td> <a href="../user/updateBlockedStatus?userId=${user.id}"><img src="../../img/minus.jpg" class="edit"></a></td>
					</c:otherwise>
					</c:choose> 
				</tr>
			</c:forEach>
		</table>		
						
<%@ include file="../general/footer.jsp" %>